package com._520it.crm.web.controller;

import com._520it.crm.domain.BankArea;
import com._520it.crm.service.IBankAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/bankarea")
public class BankAreaController {

    @Autowired
    private IBankAreaService bankAreaService;

    @RequestMapping("")
    public String index() {
        return  "bankarea";
    }

    @RequestMapping("/queryTree")
    @ResponseBody
    public List<BankArea> queryTree(){
        List<BankArea> result = bankAreaService.queryTree();
        return result;
    }

    @RequestMapping("/queryChildrenByParentId")
    @ResponseBody
    public List<BankArea> queryChildrenByParentId(Long parentId){
        List<BankArea> result = bankAreaService.queryChildrenByParentId(parentId);
        return result;
    }
}
